package org.example.pglog.pojo;

/**
 * @author: 船长
 * @create: 2024-09-01 15:13
 **/

public class FieldDiff {

    /**
     * 字段英文名
     */
    private String fieldENName;

    /**
     * 字段中文名
     */
    private String fieldCNName;

    /**
     * 旧值
     */
    private Object oldValue;

    /**
     * 新值
     */
    private Object newValue;


    public FieldDiff(String fieldENName, String fieldCNName, Object oldValue, Object newValue) {
        this.fieldENName = fieldENName;
        this.fieldCNName = fieldCNName;
        this.oldValue = oldValue;
        this.newValue = newValue;
    }

    public String getFieldENName() {
        return fieldENName;
    }

    public void setFieldENName(String fieldENName) {
        this.fieldENName = fieldENName;
    }

    public String getFieldCNName() {
        return fieldCNName;
    }

    public void setFieldCNName(String fieldCNName) {
        this.fieldCNName = fieldCNName;
    }

    public Object getOldValue() {
        return oldValue;
    }

    public void setOldValue(Object oldValue) {
        this.oldValue = oldValue;
    }

    public Object getNewValue() {
        return newValue;
    }

    public void setNewValue(Object newValue) {
        this.newValue = newValue;
    }

    @Override
    public String toString() {
        String oldVal = this.oldValue == null ? "" : this.oldValue.toString();
        String newVal = this.newValue == null ? "" : this.newValue.toString();
        return fieldENName + "将 " + this.fieldCNName + " 从“" + oldVal + "” 修改为 “" + newVal + "”";
    }

}
